package edu.xpu.project.user.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
 * @describe 科目表(语文、数学、英语...)
 * @author liukang
 * @date 2017年5月19日
 */
@Entity(name="CourseType")
@Table(name="XPU_COURSE_TYPE")
@JsonIgnoreProperties(value={"scoreEntities"})
public class CourseType implements Serializable {
	private static final long serialVersionUID = -8878348858518739429L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	private String courseName;
	
	/*
	 * 每一个科目有n道题, 如何存储
	 */
	
	@OneToMany(mappedBy="courseType", fetch=FetchType.LAZY, cascade={CascadeType.PERSIST})
	private Set<ScoreEntity> scoreEntities;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public Set<ScoreEntity> getScoreEntities() {
		return scoreEntities;
	}

	public void setScoreEntities(Set<ScoreEntity> scoreEntities) {
		this.scoreEntities = scoreEntities;
	}
	
}
